﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections;
using System.Printing;
using CCF20Model;

namespace CCF20Module
{
    /// <summary>
    /// Interaction logic for PrintCustomer.xaml
    /// </summary>
    public partial class PrintCustomer : Window
    {
        public PrintCustomer(CustomerData Customer)
        {
            InitializeComponent();
            this.DataContext = Customer;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            PrintDialog printDialog = new PrintDialog();

            if (printDialog.ShowDialog() == true)
            {
                    Size pageSize = new Size(printDialog.PrintableAreaWidth - 20, printDialog.PrintableAreaHeight - 20);

                    customerGrid.Measure(pageSize);
                    customerGrid.Arrange(new Rect(10, 50, pageSize.Width, pageSize.Height));
                    printDialog.PrintVisual(customerGrid, "A Scaled Drawing");

            }
        }
    }
}
